﻿@model IEnumerable<Provider.Models.Tool>

@{
    ViewBag.Title = "Tools";
}

<h2>@ViewBag.Title.</h2>
<h3>A list of all the tools offered by this provider.</h3>

<p>
    Remember, you are one of several users of this sample provider. 
    Please do not muck with other people's tools.
</p>

@if (!Model.Any()) {
    <text>
        No tools have been created yet.
    </text>
} else {
    <text>
        <table class="table">

            @foreach (var item in Model) {
                <tr>
                    <td>
                        @Html.ActionLink(item.Name, "Details", new { id = item.ToolId }, htmlAttributes: new { title = item.Description })
                    </td>
                    <td>
                        @Html.ActionLink("Edit", "Edit", new { id = item.ToolId }) |
                        @Html.ActionLink("Delete", "Delete", new { id = item.ToolId })
                    </td>
                </tr>
            }

        </table>
    </text>
}

<p>
    @Html.ActionLink("Create New", "Create") |
    @Html.ActionLink("Back to Home", "Index", "Home")
</p>